Page({
	data: {
    sixty:"",
    display1: "block",
    display2: "none",
		tel: '',
		password: '',
    imgurl: "../../../images/iconImgs/logo.png"
	},
	bindTel: function(e) {
		this.setData({tel: e.detail.value})
	},
  bindVe: function (e) {
    this.setData({ ve: e.detail.value })
  },
  toVerification:function(){
    if ((/^1(3|4|5|7|8)\d{9}$/.test(this.data.tel))){
      wx.showToast({
        title: '请留意手机短信',
        icon: 'success',
        duration: 1000
      })
      var that = this
      that.setData({
        display1: "none",
        display2: "block"
      })
      var seconds = 10
      var clock = setInterval(doLoop, 1000)
      function doLoop() {
        if (seconds > 0) {
          seconds--;
          that.setData({
            sixty: seconds + "秒后可继续发送",
          })
        } else {
          clearInterval(clock)
          seconds = 10
          that.setData({
            sixty: "",
            display1: "block",
            display2: "none",
          })
        }
      }
    }else{
      wx.showToast({
        title: '号码格式不正确',
        icon: 'fail',
        duration: 1000
      })
    }
  },
	login: function(e) {
    var ve = this.data.ve;
    if (ve == 1234){
      wx.showToast({ title: '请求中', icon: 'loading', duration: 1000 });
      wx.navigateTo({
         url: '../upLoad/index'
      });
      //网络请求开始
      // wx.request({
      //   url: 'http://xxx.com/account/Login?email=' + this.data.email + '&password=' + this.data.password,
      //   header: {
      //     'Content-Type': 'application/json'
      //   },
      //   success: function (res) {
      //     wx.hideToast();
      //     if (res.data.LoginStatus == 1) {
      //       //进行一些用户状态的存储
      //       //进行 tab 的切换
      //       wx.navigateTo({
      //         url: '../../upLoad/index'
      //       });
      //     } else {
      //       wx.showModal({
      //         title: '登录失败', content: '请检查您的网络！', showCancel: false, success: function (res) {
      //           //回调函数
      //         }
      //       })
      //     }
      //   }
      // })
    }else{
      wx.showToast({
        title: '验证码不正确',
        icon: 'fail',
        duration: 1000
      })
    }
	}
})
